package com.boardour.wifip2p.packet;

public class BytesReceivePacket extends ReceivePacket {
    private byte[] bytes;
    private int position;

    public BytesReceivePacket(int length) {
        this.length = length;
        this.bytes = new byte[length];
    }

    public BytesReceivePacket(byte type, byte[] bytes, long time) {
        this.type = type;
        this.bytes = bytes;
        this.time = time;
    }

    @Override
    public void save(byte[] data, int count) {
        System.arraycopy(data, 0, bytes, position, count);
        position += count;
    }

    public byte[] getBytes() {
        return bytes;
    }

    @Override
    public void close() {

    }
}
